<template>
	<div class="fundInfoCLass">
		<div class="headerClass">
			<span>{{ fundDetailData.baseInfo ? fundDetailData.baseInfo['fundFullName'] : '' }}</span>
			<el-popover placement="bottom-start" trigger="focus" class="sousuoliebfuji">
				<div
					:style="!searchValue.trim() ? `width:312px !important;` : ``"
					class="searchListClass"
					v-loading="searchLoading"
					element-loading-text="正在搜索数据"
					element-loading-spinner="el-icon-loading"
					element-loading-background="rgba(0, 0, 0, 0.8)"
				>
					<div class="searchItem" v-if="searchList.length">
						<div class="listHeader">找到{{ searchList.length }}项含有“{{ searchValue }}”的内容</div>
						<div class="listHeader valueitem" v-for="(item, index) in searchList" :key="item.key + 'search' + index">
							<div v-html="item.label + '：' + item.value"></div>
							<div class="weiyu">
								位于
								<span class="fujiedianweizhi" @click="switchStep(item)">
									{{ item.parentValue }}
								</span>
							</div>
						</div>
					</div>
					<el-empty
						:description="searchValue.trim() ? '没有查找到你要搜索的内容' : '请输入要查找的内容'"
						v-if="!searchList.length"
					></el-empty>
				</div>
				<el-input
					slot="reference"
					v-model="searchValue"
					placeholder="请输入"
					clearable
					@input="searchFunc"
					ref="searchRef"
					size="medium"
					style="width: 311px"
				/>
			</el-popover>
		</div>

		<div class="infoComClass">
			<el-tabs v-model="activeName" @tab-click="handleClick">
				<el-tab-pane :label="item.label" :name="item.key" v-for="item in allData.treeData" :key="item.key">
					<!-- 其他步骤信息 -->
					<template v-if="!['fundManagerInfoList', 'fundFileInfo', 'baseInfo', 'rateInfo'].includes(item.key)">
						<template v-if="item.children.length">
							<div class="propertyList">
								<div v-for="items in item.children" :key="items.key + item.key" style="width: 50%; display: flex">
									<div class="propertyListClass1">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty[items.parentKey][fieldSwitching(items.key)]"
										>
											<span slot="reference">{{ items.label }}</span>
										</el-popover>
									</div>
									<div class="propertyListClass2">
										{{ items.value }}
									</div>
								</div>
								<div v-if="item.children.length % 2 !== 0" style="width: 50%; display: flex">
									<div class="propertyListClass1"></div>
									<div class="propertyListClass2"></div>
								</div>
							</div>
						</template>
						<el-empty :image-size="200" v-else></el-empty>
					</template>

					<!-- 基础信息以及下属基金 -->
					<template v-if="['baseInfo'].includes(item.key)">
						<div class="propertyList">
							<div v-for="items in item.children" :key="items.key + item.key" style="width: 50%; display: flex">
								<div class="propertyListClass1">
									<el-popover
										placement="top-start"
										width="200"
										trigger="hover"
										:content="$store.getters.hoverPerty[items.parentKey][items.key]"
									>
										<span slot="reference">{{ items.label }}</span>
									</el-popover>
								</div>
								<div class="propertyListClass2">
									{{ items.value }}
								</div>
							</div>
							<div v-if="item.children.length % 2 !== 0" style="width: 50%; display: flex">
								<div class="propertyListClass1"></div>
								<div class="propertyListClass2"></div>
							</div>
						</div>
						<!-- 下属基金 -->
						<div v-if="allData.branchShareList">
							<div class="branchShareListchildren1">下属基金列表</div>
							<el-table :data="allData.branchShareList" style="width: 100%" border :header-cell-style="{ background: '#F6F4F4' }">
								<el-table-column
									prop="fundCode"
									label="基金代码（六位）"
									width="140px"
									v-if="allData.branchShareListProperty.includes('fundCode')"
								>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['fundCode']"
										>
											<span slot="reference">基金代码（六位）</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column
									prop="fundGradName"
									label="下属份额类别简称"
									v-if="allData.branchShareListProperty.includes('fundGradName')"
								>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['fundName']"
										>
											<span slot="reference">下属份额类别简称</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column
									prop="fundGradFullName"
									label="下属份额类别全称"
									v-if="allData.branchShareListProperty.includes('fundGradFullName')"
								>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['fundFullName']"
										>
											<span slot="reference">下属份额类别全称</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column
									prop="subFundTypeChine"
									label="下属基金类型"
									width="120px"
									v-if="allData.branchShareListProperty.includes('subFundType')"
								>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['subFundType']"
										>
											<span slot="reference">下属基金类型</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column
									prop="estimatedRaisedAmount"
									label="预计募集金额"
									width="120px"
									v-if="allData.branchShareListProperty.includes('estimatedRaisedAmount')"
								>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['estimatedRaisedAmount']"
										>
											<span slot="reference">预计募集金额</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column
									prop="estimatedAnnualRate"
									label="预计年收益率"
									width="120px"
									v-if="allData.branchShareListProperty.includes('estimatedAnnualRate')"
								>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['estimatedAnnualRate']"
										>
											<span slot="reference">预计年收益率</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column prop="shareCategory" label="份额类别" width="120px" v-if="shareSategoryShow()">
									<template slot-scope="scope">
										{{ shareSategoryShow(1, scope.row.shareCategory) }}
									</template>
									<template slot="header">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['baseInfo']['shareCategory']"
										>
											<span slot="reference">份额类别</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column
									prop="estimatedAnnualRate"
									label="预计年收益率是否适用"
									width="170px"
									v-if="allData.branchShareListProperty.includes('estimatedAnnualRate')"
								>
									<template slot-scope="scope">
										{{ scope.row.estimatedAnnualRate ? '适用' : '不适用' }}
									</template>
								</el-table-column>
							</el-table>
						</div>
					</template>

					<!-- 文件信息 -->
					<template v-if="['fundFileInfo'].includes(item.key)">
						<div v-if="item.children.length">
							<el-table :data="item.children" style="width: 100%" border :header-cell-style="{ background: '#F6F4F4' }">
								<el-table-column prop="fileType" label="文件类型">
									<template slot-scope="scope">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty['fundFileInfo'][scope.row.key]"
										>
											<span slot="reference">
												{{ scope.row.fileType }}
											</span>
										</el-popover>
									</template>
								</el-table-column>
								<el-table-column prop="idType" label="生效时间" class-name="shengxiaoshijian">
									<template slot-scope="{ row }">
										<div class="imgparnode">
											<div class="childrenimg" v-if="row.sealedFileId">{{ row.sealedEffectiveDate | timerConversionStr }}</div>
											<div class="childrenimg" v-if="row.firstFileId">{{ row.firstEffectiveDate | timerConversionStr }}</div>
											<div class="childrenimg" v-if="row.finalFileId">{{ row.finalEffectiveDate | timerConversionStr }}</div>
										</div>
									</template>
								</el-table-column>
								<el-table-column prop="idNo" label="操作" class-name="shengxiaoshijian">
									<template slot="header" style="display: flex; align-items: center">
										<span>操作</span>
										<el-popover placement="top-start" width="200" trigger="hover" content="">
											<div>
												<div class="hoverImg">
													<div>word版：</div>
													<img src="../assets/icon_word.png" />
												</div>
												<div class="hoverImg">
													<div>盖章版：</div>
													<img src="../assets/icon_gaizhang.png" />
												</div>
												<div class="hoverImg">
													<div>PDF版：</div>
													<img src="../assets/icon_pdf.png" />
												</div>
											</div>
											<span slot="reference" style="margin-left: 10px; cursor: pointer; padding-top: 5px"
												><i class="iconfont icon-icon_yiwenkongxin" style="font-size: 15px"></i
											></span>
										</el-popover>
									</template>
									<template slot-scope="{ row }">
										<div class="imgparnode">
											<div class="childrenimg" v-if="row.sealedFileId">
												<img src="../assets/icon_gaizhang@2x.png" alt="" @click="downloadFileFunc(row.sealedFileId)" />
											</div>
											<div class="childrenimg" v-if="row.firstFileId">
												<img src="../assets/icon_word@2x.png" alt="" @click="downloadFileFunc(row.firstFileId)" />
											</div>
											<div class="childrenimg" v-if="row.finalFileId">
												<img src="../assets/icon_pdf@2x.png" alt="" @click="downloadFileFunc(row.finalFileId)" />
											</div>
										</div>
									</template>
								</el-table-column>
							</el-table>
						</div>
						<div v-if="fileRenewApplyList.length && updateFileProperty.length">
							<div class="branchShareListchildren1">更新列表</div>
							<el-table :data="fileRenewApplyList" style="width: 100%" border :header-cell-style="{ background: '#F6F4F4' }">
								<el-table-column prop="managerName" label="文件类型">
									<template slot-scope="{ row }">{{ updateFileTitle(row) }}</template>
								</el-table-column>
								<el-table-column prop="idType" label="生效时间" class-name="shengxiaoshijian">
									<template slot-scope="{ row }">
										<div class="imgparnode">
											<div class="childrenimg" v-if="row.sealedFileId">{{ row.sealedEffectiveDate | timerConversionStr }}</div>
											<div class="childrenimg" v-if="row.firstFileId">{{ row.firstEffectiveDate | timerConversionStr }}</div>
											<div class="childrenimg" v-if="row.finalFileId">{{ row.finalEffectiveDate | timerConversionStr }}</div>
										</div>
									</template>
								</el-table-column>
								<el-table-column prop="idNo" label="操作" class-name="shengxiaoshijian">
									<template slot="header" style="display: flex; align-items: center">
										<span>操作</span>
										<el-popover placement="top-start" width="200" trigger="hover" content="">
											<div>
												<div class="hoverImg">
													<div>word版：</div>
													<img src="../assets/icon_word.png" />
												</div>
												<div class="hoverImg">
													<div>盖章版：</div>
													<img src="../assets/icon_gaizhang.png" />
												</div>
												<div class="hoverImg">
													<div>PDF版：</div>
													<img src="../assets/icon_pdf.png" />
												</div>
											</div>
											<span slot="reference" style="margin-left: 10px; cursor: pointer; padding-top: 5px"
												><i class="iconfont icon-icon_yiwenkongxin" style="font-size: 15px"></i
											></span>
										</el-popover>
									</template>
									<template slot-scope="{ row }">
										<div class="imgparnode">
											<div class="childrenimg" v-if="row.sealedFileId">
												<img src="../assets/icon_gaizhang@2x.png" alt="" @click="downloadFileFunc(row.sealedFileId)" />
											</div>
											<div class="childrenimg" v-if="row.firstFileId">
												<img src="../assets/icon_word@2x.png" alt="" @click="downloadFileFunc(row.firstFileId)" />
											</div>
											<div class="childrenimg" v-if="row.finalFileId">
												<img src="../assets/icon_pdf@2x.png" alt="" @click="downloadFileFunc(row.finalFileId)" />
											</div>
										</div>
									</template>
								</el-table-column>
							</el-table>
						</div>

						<el-empty :image-size="200" v-if="!fileRenewApplyList.length && !item.children.length"></el-empty>
					</template>

					<!-- 基金经理 -->
					<template v-if="['fundManagerInfoList'].includes(item.key)">
						<div v-if="item.children.length" style="margin: 9px 0">
							<el-table :data="item.children" style="width: 100%" border :header-cell-style="{ background: '#F6F4F4' }">
								<el-table-column prop="managerName" label="姓名" v-if="allData.fundManageProperty.includes('managerName')">
								</el-table-column>
								<el-table-column prop="idType" label="证件类型" v-if="allData.fundManageProperty.includes('idType')">
								</el-table-column>
								<el-table-column prop="idNo" label="证件号码" v-if="allData.fundManageProperty.includes('idNo')"> </el-table-column>
								<el-table-column prop="startDate" label="任职日期" v-if="allData.fundManageProperty.includes('startDate')">
								</el-table-column>
								<el-table-column prop="endDate" label="离职日期" v-if="allData.fundManageProperty.includes('endDate')">
								</el-table-column>
								<el-table-column
									prop="entryNoticeDate"
									label="任职公告日期"
									v-if="allData.fundManageProperty.includes('entryNoticeDate')"
								>
								</el-table-column>
								<el-table-column
									prop="leaveNoticeDate"
									label="离职公告日期"
									v-if="allData.fundManageProperty.includes('leaveNoticeDate')"
								>
								</el-table-column>
							</el-table>
						</div>
						<el-empty :image-size="200" v-else></el-empty>
					</template>

					<!-- 费率信息 -->
					<template v-if="['rateInfo'].includes(item.key)">
						<template v-if="item.children.length">
							<div class="propertyList">
								<div v-for="(items, indexs) in item.children" :key="items.key + item.key + indexs" style="width: 50%; display: flex">
									<div class="propertyListClass1">
										<el-popover
											placement="top-start"
											width="200"
											trigger="hover"
											:content="$store.getters.hoverPerty[items.parentKey][items.key]"
										>
											<span slot="reference">{{ items.label }}</span>
										</el-popover>
									</div>
									<div class="propertyListClass2">
										{{ items.value }}
									</div>
								</div>
								<div v-if="item.children.length % 2 !== 0" style="width: 50%; display: flex">
									<div class="propertyListClass1"></div>
									<div class="propertyListClass2"></div>
								</div>
							</div>
							<template v-if="allData.feeRateInfoList">
								<div class="rateListParnode" v-for="(items, indexs) in allData.feeRateInfoList" :key="indexs + 'feilv'">
									<!-- 普通认购 -->
									<div class="rateListClass" v-if="items.subRateList && items.subRateList.length">
										<!-- <div class="rateListheader">{{ items.title }}认购费率</div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['ordinarySubscription']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('1') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent">
												<div class="contentChildren">认购金额（含认购费）</div>
												<div class="contentChildren">认购金额（含认购费）</div>
												<div class="contentChildren">认购金额（含认购费）</div>
												<div class="contentChildren">认购费率</div>
											</div>
											<div class="ItemContent" v-for="(value, key) in items.subRateList" :key="key + 'putongrengou' + indexs">
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤金额（万元）≤</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
											</div>
										</div>
									</div>

									<!-- 通过直销中心认购 -->
									<div class="rateListClass" v-if="items.subCntList && items.subCntList.length">
										<!-- <div class="rateListheader"></div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['pensionCustomers']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('2') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent">
												<div class="contentChildren">认购金额（含认购费）</div>
												<div class="contentChildren">认购金额（含认购费）</div>
												<div class="contentChildren">认购金额（含认购费）</div>
												<div class="contentChildren">认购费率</div>
											</div>
											<div class="ItemContent" v-for="(value, key) in items.subCntList" :key="key + 'zhixiaozhongxin' + indexs">
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤金额（万元）≤</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
											</div>
										</div>
									</div>

									<!-- 前端-普通申购 -->
									<div class="rateListClass" v-if="items.applyRateList && items.applyRateList.length">
										<!-- <div class="rateListheader">{{ items.title }}前端-申购费率</div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['generalSubscription']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('3') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent">
												<div class="contentChildren">申购金额</div>
												<div class="contentChildren">申购金额</div>
												<div class="contentChildren">申购金额</div>
												<div class="contentChildren">申购费率</div>
											</div>
											<div
												class="ItemContent"
												v-for="(value, key) in items.applyRateList"
												:key="key + 'qianduanputongrengou' + indexs"
											>
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤金额（万元）≤</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
											</div>
										</div>
									</div>

									<!-- 前端-通过直销中心申购的养老金客户-->
									<div class="rateListClass" v-if="items.applyCntList && items.applyCntList.length">
										<!-- <div class="rateListheader"></div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['subscriptionCustomers']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('4') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent">
												<div class="contentChildren">申购金额</div>
												<div class="contentChildren">申购金额</div>
												<div class="contentChildren">申购金额</div>
												<div class="contentChildren">申购费率</div>
											</div>
											<div
												class="ItemContent"
												v-for="(value, key) in items.applyCntList"
												:key="key + 'qianduanzhixiaozhongxinrengou' + indexs"
											>
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤金额（万元）≤</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
											</div>
										</div>
									</div>

									<!-- 后端-普通申购 -->
									<div class="rateListClass" v-if="items.rearRndApplyRateList && items.rearRndApplyRateList.length">
										<!-- <div class="rateListheader">{{ items.title }}后端-申购费率</div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['obEndSubscription']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('10') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent">
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">申购费率</div>
											</div>
											<div
												class="ItemContent"
												v-for="(value, key) in items.rearRndApplyRateList"
												:key="key + 'qianduanputongshengou' + indexs"
											>
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤ 日期 ＜</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
											</div>
										</div>
									</div>

									<!-- 后端-通过直销中心申购的养老金客户 -->
									<div class="rateListClass" v-if="items.rearRndApplyCntList && items.rearRndApplyCntList.length">
										<!-- <div class="rateListheader"></div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['bendPensionS']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('11') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent">
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">申购费率</div>
											</div>
											<div
												class="ItemContent"
												v-for="(value, key) in items.rearRndApplyCntList"
												:key="key + 'houduanzhixiaozhongxin' + indexs"
											>
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤ 日期 ＜</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
											</div>
										</div>
									</div>

									<!--普通赎回  -->
									<!-- <div style="width: 100%" v-if="items.ransomRateList && items.ransomRateList.length"> -->
									<div class="rateListClass" v-if="items.ransomRateList && items.ransomRateList.length">
										<!-- <div class="rateListheader">{{ items.title }}普通赎回</div> -->
										<div class="rateListItem">
											<div class="rateListItemHeader">
												<el-popover
													placement="top-start"
													width="200"
													trigger="hover"
													:content="$store.getters.hoverPerty['rateInfo']['ordinaryRedemption']"
												>
													<span slot="reference"> {{ items.title }}{{ listItemHeader('5') }} </span>
												</el-popover>
											</div>
											<div class="ItemContent shuhuifeilv">
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">持有期限</div>
												<div class="contentChildren">赎回费率</div>
												<div class="contentChildren">归基金资产比例</div>
											</div>
											<div
												class="ItemContent shuhuifeilv"
												v-for="(value, key) in items.ransomRateList"
												:key="key + 'shuhuifeilv' + indexs"
											>
												<div class="contentChildren">{{ value.startSection }}</div>
												<div class="contentChildren">≤ 日期 ＜</div>
												<div class="contentChildren">{{ value.endSection }}</div>
												<div class="contentChildren">
													{{ value.feeRate ? `${value.feeRate}${value.feeRateUnit === '2' ? '元/笔' : '%'}` : '' }}
												</div>
												<div class="contentChildren">{{ value.belongFundRatio ? `${value.belongFundRatio}%` : '' }}</div>
											</div>
										</div>
									</div>
									<!-- </div> -->
								</div>
							</template>
						</template>
						<el-empty :image-size="200" v-else></el-empty>
					</template>
					<!--  -->
				</el-tab-pane>
			</el-tabs>
		</div>
		<!--  -->
	</div>
</template>
<script>
import { exportFundData } from '@/api/graphQl/fundDataExport'
import { RoleVisible } from '@/api/productApi/rolesSetting'
import { processingRawData, graphiqlParams, dataConversionMethod, EnumList, TreeSearch, updateFileType } from './treeData'
import { jsonArray } from '@/api/productApi/file'
import { getEnum } from '@/api/productApi/file'
import { getSpecialTypeInfo } from '@/api/productApi/infoMain'
import { getNewspaperList } from '@/api/productApi/newspaper'
import { downloadFile } from '@/api/productApi/file'
import { SpecialReplace } from '@/utils/characters'
import { getFundFile } from '@/api/productApi/infoMain'
import { debounce } from '@/utils/debounce'
export default {
	name: 'FundInfo',

	components: {},

	data() {
		return {
			updateFileType,
			searchValue: '',
			activeName: 'baseInfo',
			fundDetailData: {}, // 基金详细数据
			enumData: {}, // 枚举数据
			specialTypeList: [], // 特殊品种类型数据
			newSpaperList: [], // 报社
			allData: {},
			searchLoading: false,
			searchList: [], // 搜索列表
			fundManageProperty: [],
			updateFileProperty: [], // 存储披露更新文件key
			fileRenewApplyList: [] // 更新文件
		}
	},

	async mounted() {
		await this.$store.dispatch('fundStep/setHover')
		await this.getEnumData()
		await this.getSpecialTypeInfo()
		await this.getNewspaperListFunc()
		this.judgeParam()
	},

	methods: {
		updateFileTitle(items) {
			const data = this.updateFileType.find(
				obj => obj.fileRenewCode === items.fileRenewCode && obj.fundRaiseType === this.$route.query.fundRaiseType
			)
			return data ? data.title : ''
		},

		shareSategoryShow(num, typeCode) {
			let show = null
			if (!num) {
				this.allData.allOne.forEach(item => {
					if (item.key === 'isGradFund') {
						if (item.value === '结构化分级') {
							show = true
						}
					}
				})
				return show
			} else {
				const obj = this.enumData.shareCategory.find(item => item.typeCode === typeCode)
				show = obj ? obj.typeName : ''
				return show
			}
		},

		listItemHeader(rateType) {
			return [
				{ key: '5', value: '普通赎回' },
				{ key: '11', value: '后端-通过直销中心申购的养老金客户' },
				{ key: '1', value: '普通认购' },
				{ key: '2', value: '通过直销中心认购的养老金客户' },
				{ key: '3', value: '前端-普通申购' },
				{ key: '10', value: '后端-普通申购' },
				{ key: '4', value: '前端-通过直销中心申购的养老金客户' }
			].find(item => item.key === rateType).value
		},

		// 文件下载
		downloadFileFunc(id) {
			downloadFile({ fid: id }).then(item => {
				if (item.msgCode === 'N') {
					this.$message({ showClose: true, message: '文件不存在', type: 'error' })
					return
				}
				if (item) {
					this.$message({
						showClose: true,
						message: '正在下载，请稍等......',
						type: 'success'
					})
					window.open(`/update/download.do?fid=${id}`)
				}
			})
		},

		switchStep(obj) {
			this.activeName = obj.parentKey
		},

		searchFunc: debounce(function() {
			if (SpecialReplace(this.searchValue, false)) {
				return
			}
			if (!this.searchValue.trim()) {
				this.searchList = []
				this.searchLoading = false
				return
			}
			this.searchLoading = true
			setTimeout(() => {
				const list = jsonArray(
					this.allData.allOne.filter(item => item.value.includes(this.searchValue) || item.label.includes(this.searchValue))
				)
				const reg = new RegExp(`${this.searchValue}`, 'g')
				list.forEach(item => {
					item.value = item.value.replace(reg, `<span style="color:red;">${this.searchValue}</span>`)
					item.label = item.label.replace(reg, `<span style="color:red;">${this.searchValue}</span>`)
				})
				this.searchList = list
				this.$nextTick(() => {
					this.searchLoading = false
				})
			}, 500)
		}, 500),

		handleClick(tab, event) {},

		// 如果没有携带基金系统id，则返回数据列表
		judgeParam() {
			if (!this.$route.query.fundSysCode || !this.$route.query.fundRaiseType) {
				this.$router.push({ path: '/integratedQuery/fundList' })
			} else {
				RoleVisible({ raiseType: this.$route.query.fundRaiseType }).then(res => {
					if (res.msgCode === 'Y') {
						if (!res.data.body.length) {
							this.$router.push({ path: '/integratedQuery/fundList' })
							return
						}
						// 取出更新文件列表
						const updateFile = res.data.body.filter(item => item.fieldCode === 'updateFile')
						let updateFileIdList = ''
						if (updateFile.length) {
							updateFile.forEach(item => {
								item.childNodeList = res.data.body.filter(items => items.parentId === item.fieldId)
								updateFileIdList = item.fieldId
								item.childNodeList.forEach(items => {
									this.updateFileProperty.push(items.fieldCode)
								})
							})
						}
						// 去除更新文件列表
						const list = processingRawData(
							res.data.body.filter(item => item.fieldId !== updateFileIdList && item.parentId !== updateFileIdList)
						)
						if (list.length) {
							if (list[0].childNodeList && Array.isArray(list[0].childNodeList) && list[0].childNodeList.length) {
								this.activeName = list[0].childNodeList[0].fieldCode
							}
						}
						const data = graphiqlParams(this.$route.query, jsonArray(list))
						exportFundData(data).then(graphql => {
							if (graphql.data.getFundDetailInfoV1.fundDetailGraphqlDTOs) {
								this.fundDetailData = dataConversionMethod(
									jsonArray(graphql.data.getFundDetailInfoV1.fundDetailGraphqlDTOs),
									jsonArray(this.enumData),
									jsonArray(this.specialTypeList),
									this.newSpaperList
								)[0]
								this.allData = TreeSearch(this.fundDetailData, res.data.body, this.$route.query.fundRaiseType, this.enumData)
								this.activeName = this.allData.firstStep
							}
						})
						getFundFile({ fundSysCode: this.$route.query.fundSysCode, fundRaiseType: this.$route.query.fundRaiseType }).then(res => {
							if (res.msgCode === 'Y') {
								this.fileRenewApplyList = res.data.body.filter(item => this.updateFileProperty.includes(item.fileRenewCode))
								this.fileRenewApplyList = this.fileRenewApplyList.filter(
									item => item.sealedFileId || item.firstFileId || item.finalFileId
								)
							}
						})
					}
				})
			}
		},

		fieldSwitching(property) {
			const list = ['csrcTypeName', 'certificateTypeName', 'peopleMaxName', 'peopleMinName']
			if (list.includes(property)) {
				if (property === 'csrcTypeName') {
					return 'csrcType'
				}
				if (property === 'certificateTypeName') {
					return 'certificateType'
				}
				if (property === 'peopleMaxName') {
					return 'peopleMax'
				}
				if (property === 'peopleMinName') {
					return 'peopleMin'
				}
			} else {
				return property
			}
		},

		// 查询-特殊品种类型
		async getSpecialTypeInfo() {
			await getSpecialTypeInfo().then(res => {
				if (res.msgCode === 'Y') {
					this.specialTypeList = res.data.body
				}
			})
		},

		// 获取报社列表
		async getNewspaperListFunc() {
			await getNewspaperList().then(res => {
				if (res.msgCode === 'Y') {
					this.newSpaperList = res.data.body
				}
			})
		},

		// 获取枚举数据
		async getEnumData() {
			await getEnum([
				'productAssetReportType',
				'addCreditFormType',
				'addCreditOrganType',
				'investAdvisorOrgan',
				'feeRateAlgorithm',
				'peopleMax',
				'peopleMinNoBank',
				'peopleMinSpv',
				'csrcTypeOrgan',
				'csrcTypePersonal',
				'csrcTypeProduct',
				'idType',
				'idTypeOrgan',
				'idTypeProduct',
				'operateMode',
				'openFrequency',
				'fiduciaryDuty',
				'settleCurrency',
				'mixedInvestBias',
				'valuationWay',
				'valuationFrequency',
				'marketFundType',
				'marketTradeSite',
				'investTactics',
				'revenueFeature',
				'gradFundType',
				'riskGrade',
				'fundType',
				'subFundType',
				'productAssetType',
				'productSpecialType',
				'addcreditMeasure',
				'annuityPlan',
				'incomeDisWay',
				'planType',
				'privateFundType',
				'annuityPlanType',
				'annuityTrusteeMode',
				'addcreditMeasureType',
				'shareCategory', // 下属基金份额类别
				'custodyFeeAlgorithm',
				'salesServiceFeeAlgorithm',
				'associationOpenFrequency'
			]).then(res => {
				if (res.msgCode === 'Y') {
					EnumList.forEach(item => {
						if (item.enumKey !== 'csrcTypeOrgan' && res.data.body[item.enumKey]) {
							res.data.body[item.propertyKey] = res.data.body[item.enumKey]
						}
						if (item.enumKey === 'csrcTypeOrgan') {
							res.data.body[item.propertyKey] = [
								...res.data.body['csrcTypeOrgan'],
								...res.data.body['csrcTypePersonal'],
								...res.data.body['csrcTypeProduct']
							]
						}
					})
					this.enumData = res.data.body
				}
			})
		}
	}
}
</script>
<style lang="scss" scoped src='./index.scss'>
</style>

